<?php
/**
 * Created by IntelliJ IDEA.
 * User: HXL
 * Date: 2018/5/9
 * Time: 12:28
 */
namespace app\orders\model;

use think\Db;
/**
 * 电子模块类型
 * Class ModelType
 * @package app\order\model
 */
class ModelTypes extends BaseModel{
    protected $tableName = 'ari_model_types';

    public function insertAll($data){
        $insertAll = Db::table($this->tableName)->insertAll($data);
        return $insertAll;
    }

    /**
     * 模糊查询
     * @return \think\paginator\Collection
     */
    public function searchLike($search){
        $count = Db::table($this->tableName)->where('model_id', 'like', "%$search%")
            ->whereOr('model_type', 'like', "%$search%")->count();
        $modelTypes = Db::table($this->tableName)->where('model_id', 'like', "%$search%")
            ->whereOr('model_type', 'like', "%$search%")->paginate(10, $count, ['query' => request()->param()]);
        return $modelTypes;
    }


}